package com.example.game_community.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Value("${app.storage.temp}")
    private String tempStoragePath;

    @Value("${app.storage.final}")
    private String finalStoragePath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/temp-images/**")
                .addResourceLocations("file:" + tempStoragePath + "/");

        registry.addResourceHandler("/images/**")
                .addResourceLocations("file:" + finalStoragePath + "/");
    }
}
